package com.bonc.vo;

/**
 * @author lenovo
 * @Title   做返回体用的
 * @Description
 * @date 2021/4/7 16:01
 */
public class ResultVO {

    /**
     * 返回码
     */
    private Integer code;

    /**
     * 返回信息
     */
    private String message;

    /**
     * 返回的数据
     */
    private Object data;

    /**
     * 数据的数量
     */
    private Integer count;

    public ResultVO(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultVO(Integer code, String message, Object data, Integer count) {
        this.code = code;
        this.message = message;
        this.data = data;
        this.count = count;
    }

    public ResultVO(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResultVO(){

    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getCount() {
        return this.count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static ResultVO success(String message){
        return new ResultVO(200,message);
    }

    public static ResultVO fail(Integer code, String message){
        return new ResultVO(code, message);
    }

    public static ResultVO success(Object data, String message, Integer count){
        return new ResultVO(200, message, data, count);
    }

    public static ResultVO success(Object data, String message){
        return success(data, message, null);
    }

    public static ResultVO success(String message, Integer count){
        return success(null, message, count);
    }

    public static ResultVO fail(Integer code, String message, Integer count){
        return new ResultVO(code, message, count);
    }
}
